/**
 * \file main.h
 * \brief Convert POSIX To Gregorian date.
 * \author Masurel Paul
 * \version 0.1
 * \date 2007/4/1
 */


#ifndef _UNIXTIME_
#define _UNIXTIME_

//! The fastest way to convert POSIX to Gregorian
class UnixTime {
	public:	
		UnixTime(int utime);
		
		int getUnixTime() const { return _utime; };

		
		int getYear() const { return _year; };
		
		
		int getMonth() const { return _month; };

		int getDay() const { return _day; };
				
		bool is_leap_year();

	private:
		int _utime;
		int _day;
		int _month;
		int _year;
		
		static const int _months_sum[12];
		
		UnixTime(){};
};

inline bool UnixTime::is_leap_year() {
	int year = getYear();
	return (((year % 4 == 0) && (year % 100 != 0)) || (year % 400) == 0);
};



#endif

